<template>
  <div class="basic_info">
    <div class="info_operation_btn">
      <div class="btn_left">
        <el-button :disabled="!buttonsPermissions.DaYin" :class="!buttonsPermissions.DaYin ? 'disabled_button' : ''"
          @click="handleShortcutKeyPrint">打印(P)</el-button>
        <el-button @click="exportExcel()" :disabled="!buttonsPermissions.DaoChu"
          :class="!buttonsPermissions.DaoChu ? 'disabled_button' : ''">导出</el-button>
        <el-button @click="onLookBill" :disabled="total === 0"
          :class="total === 0 ? 'disabled_button' : ''">查看单据</el-button>
        <el-checkbox v-model="hideRedRushFlag" @change="hideRedRushFlagChange">隐藏红冲单据</el-checkbox>
        <el-checkbox v-model="queryData.hideZfdj" @change="hideRedRushFlagChange">隐藏作废单据</el-checkbox>
      </div>
      <div class="btn_right">
        <i @click="onShowColumn()" class="set_up el-icon-s-tools"></i>
      </div>
    </div>
    <div class="info_content_div">
      <div class="div_screen">
        <div class="screen_left">
          <div class="screen_select_more_top">
            <div class="screen_select_more_title">商品名称</div>
            <div class="screen_select_more_input">
              <el-tooltip :disabled="queryData.goodsName.length <= 6" effect="dark" :content="queryData.goodsName"
                :enterable="false" placement="bottom-start">
                <el-select v-model="queryData.goodsId" style="width: 100%" filterable ref="goodsname"
                  @change="onChangeGoods" @visible-change="(value) => handleFilterMethod('', 'goodsName')"
                  :filter-method="(value) => handleFilterMethod(value, 'goodsName')">
                  <el-option v-for="item in spmcOptions" :key="item.id" :label="item.goodsName"
                    :value="item.id"></el-option>
                </el-select>
              </el-tooltip>
              <div class="screen_select_custom_more">
                <i class="el-icon-more" @click.stop="onShowCommodity"></i>
              </div>
            </div>
          </div>
          <div>
            <p>仓库</p>
            <el-select v-model="queryData.storehouseId" class="screen_select" ref="cangku" filterable
              @visible-change="(value) => handleFilterMethod('', 'storehouseName')"
              :filter-method="(value) => handleFilterMethod(value, 'storehouseName')">
              <el-option v-for="item in ckOptions" :key="item.id" :label="item.storehouseName"
                :value="item.id"></el-option>
            </el-select>
          </div>
          <div>
            <p>单据编号</p>
            <el-tooltip :disabled="queryData.orderNumber.length <= 6" effect="dark" :content="queryData.orderNumber"
              :enterable="false" placement="bottom-start">
              <input type="text" v-model="queryData.orderNumber" style="width: 120px;" placeholder="请输入" />
            </el-tooltip>
          </div>
          <div>
            <p>单据状态</p>
            <el-select placeholder v-model="queryData.orderStatus" style="width: 120px;">
              <el-option v-for="item in djztOptions" :key="item.value" :label="item.label"
                :value="item.value"></el-option>
            </el-select>
          </div>
        </div>
        <div class="screen_right">
          <el-select @change="changeDate" v-model="monthValue">
            <el-option v-for="item in monthOptions" :key="item" :label="item" :value="item"></el-option>
          </el-select>
          <el-date-picker v-model="nowDate" type="daterange" range-separator="~" start-placeholder="开始日期"
            end-placeholder="结束日期" @change="onClickPicker" value-format="yyyy-MM-dd"></el-date-picker>
          <el-button type="primary" @click="onQuery">查询</el-button>
        </div>
      </div>
      <div class="div_table">
        <div class="div_tree">
          <div class="tree_structure">
            <el-tree :data="treeData" node-key="label" highlight-current default-expand-all :expand-on-click-node="false"
              :default-checked-keys="['6']" @node-click="handleNodeClick"></el-tree>
          </div>
        </div>
        <div class="table_content">
          <el-table ref="table" border show-summary :summary-method="getSummaries" highlight-current-row :header-cell-style="{
            color: '#666666',
            textAlign: 'center',
            height: '30px',
            borderColor: '#dddddd',
          }" :data="tableData" height="100%" style="width: 100%" @sort-change="changeSort"
            @row-dblclick="handleRowDbclick" @row-click="rowClick">
            <template v-for="(item, index) in columnData">
              <el-table-column border :show-overflow-tooltip="true" :key="index"
                :label="item.zidingyiName ? item.zidingyiName : item.morenName" v-if="item.zidingyiState"
                :resizable="item.props=='goodsId_dictText'?true:false"
                :prop="item.props" :sortable="item.sortable" min-width="120px" :width="item.cellWidth">
                <template slot-scope="scope">
                  <span v-if="item.props == 'amount' || item.props == 'taxAmount'">
                    {{
                      $formatMoney(scope.row[item.props]) }}
                  </span>
                  <span v-else-if="item.props == 'number' || item.props == 'conversionNumber'">
                    {{
                      $formatNumber(scope.row[item.props]) }}
                  </span>
                  <span v-else-if="item.props == 'taxPrice' || item.props == 'price'">
                    {{
                      $formatPrice(scope.row[item.props]) }}
                  </span>
                  <span v-else-if="item.props == 'goodsId_dictText'" style="width: 100%;white-space: normal;
  word-wrap: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; text-align: left;">{{ scope.row[item.props] }}</span>
                  <span v-else>{{ scope.row[item.props] }}</span>
                </template>
              </el-table-column>
            </template>
          </el-table>
        </div>
      </div>
      <div class="table_pagination">
        <div class="pagination_div">
          <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
            :current-page="queryData.pageNo" :page-sizes="[20, 50, 100, 200]" :page-size="queryData.pageSize"
            layout="jumper, prev, pager,next, sizes" :total="total"></el-pagination>
        </div>
      </div>
    </div>
    <!-- 列配置弹框 -->
    <CConfiguration ref="setColumnRef" :columnDataArr="columnData" :defaultColumnDataArr="defaultColumnData"
      orderType="出入库明细查询" @onSaveColumn="onSaveColumn"></CConfiguration>
    <!-- 商品选择弹窗 -->
    <NewDialogCommodity ref="commodityRef" :storehouseId="queryData.ck" @onSelectCommodity="onSelectCommodity">
    </NewDialogCommodity>
    <!-- 打印 -->
    <dialog-print ref="print"></dialog-print>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import CConfiguration from '@/components/c_column/columnConfiguration1'
import { dateStrFromDate } from '@/utils/DateFormatter'
import { getAction, postAction } from '../../../api/manage'
/**打印 */
import dialogPrint from '@/views/components/dialogPrintStatic'
import NewDialogCommodity from '@/views/components/dialogCommoditySingle'
// 导入调用处理权限数据方法
import { handlePermissions, handleOtherPerms, formatMoney, formatPrice, formatNumber, delcommafy } from '@/utils/index'
import { toBillDetail } from '@/utils/billUtil'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
export default {
  name: 'inAndOutDetailsQuery',
  mixins: [JeecgListMixin],
  components: {
    CConfiguration,
    NewDialogCommodity,
    dialogPrint,
  },
  computed: {
    ...mapGetters(['name']),
    buttonsPermissions() {
      return handlePermissions('出入库明细查询')
    },
    printPermissions() {
      return handleOtherPerms('单据可多次打印')
    },
  },
  created() {
    // 默认获取当月时间
    this.getTimeRange(this.$setTimeRange(5))
    this.getGoodsData()
    this.getStorehouseOptions()
    this.handleNodeClick({})
  },
  watch: {

  },
  updated() {
    this.$nextTick(() => {
      this.$refs.table.doLayout()
    })
  },
  data() {
    return {
      // 商品名称
      spmcOptions: [],
      // 仓库
      ckOptions: [],
      // 单据状态:0.待审核5.审核通过10.作废15.反审20.红冲25.终止30.完成
      djztOptions: [
        {
          value: '0,5,20,10',
          label: '全部',
        },
        {
          value: '5',
          label: '已审核',
        },
        {
          value: '0',
          label: '未审核',
        },
        {
          value: '10',
          label: '已作废',
        },
        {
          value: '20',
          label: '已红冲',
        },
      ],
      activeModel: {},
      hideRedRushFlag: false,// 红冲状态
      // 查询条件数据
      queryData: {
        hideZfdj: false,
        goodsId: '',
        goodsName: '',
        orderNumber: '',
        orderStatus: '0,5,20,10',
        showFlag: '',
        beginTime: '',
        endTime: '',
        storehouseId: '',
        pageSize: 20, //每页的数据条数
        pageNo: 1, //默认开始页面
        orderType: undefined
      },
      monthValue: '本月',
      monthOptions: ['今日', '本周', '本月', '本年'],
      nowDate: [],
      // 表格数据
      tableData: [],
      total: 0,
      // 列配置数据
      defaultColumnData: [],
      columnData: [
        {
          morenName: '序号',
          zidingyiName: '',
          morenState: true,
          zidingyiState: true,
          noModify: true,
          cellWidth: '70px',
          props: 'xh',
        },
        {
          morenName: '单据日期',
          zidingyiName: '',
          morenState: true,
          sortable: true,
          zidingyiState: true,
          noModify: false,
          cellWidth: '170px',
          props: 'orderTime',
        },
        {
          morenName: '单据类型',
          zidingyiName: '',
          morenState: true,
          zidingyiState: true,
          noModify: false,
          cellWidth: '100px',
          props: 'orderType_dictText',
        },
        {
          morenName: '单据编号',
          zidingyiName: '',
          morenState: true,
          sortable: true,
          zidingyiState: true,
          noModify: false,
          cellWidth: '170px',
          props: 'orderNumber',
        },
        {
          morenName: '仓库',
          zidingyiName: '',
          morenState: true,
          sortable: true,
          zidingyiState: true,
          noModify: false,
          cellWidth: '100px',
          props: 'storehouseId_dictText',
        },
        {
          morenName: '商品编码',
          zidingyiName: '',
          morenState: true,
          sortable: true,
          zidingyiState: true,
          noModify: false,
          cellWidth: '100px',
          props: 'goodsNumber',
        },
        {
          morenName: '商品名称',
          zidingyiName: '',
          morenState: true,
          zidingyiState: true,
          noModify: false,
          cellWidth: '100px',
          props: 'goodsId_dictText',
        },
        {
          morenName: '规格',
          zidingyiName: '',
          morenState: true,
          zidingyiState: true,
          noModify: false,
          cellWidth: '100px',
          props: 'norms',
        },
        {
          morenName: '单位',
          zidingyiName: '',
          morenState: true,
          zidingyiState: true,
          noModify: false,
          cellWidth: '100px',
          props: 'unit',
        },
        {
          morenName: '数量',
          zidingyiName: '',
          morenState: true,
          sortable: true,
          zidingyiState: true,
          noModify: false,
          cellWidth: '100px',
          props: 'number',
        },
        {
          morenName: '税后单价',
          zidingyiName: '',
          morenState: true,
          sortable: true,
          zidingyiState: true,
          noModify: false,
          cellWidth: '100px',
          props: 'taxPrice',
        },
        {
          morenName: '金额小计',
          zidingyiName: '',
          morenState: true,
          sortable: true,
          zidingyiState: true,
          noModify: false,
          cellWidth: '100px',
          props: 'amount',
        },
        {
          morenName: '基本单位',
          zidingyiName: '',
          morenState: true,
          zidingyiState: true,
          noModify: false,
          cellWidth: '100px',
          props: 'baseUnit_dictText',
        },
        {
          morenName: '折算数量',
          zidingyiName: '',
          morenState: true,
          sortable: true,
          zidingyiState: true,
          noModify: false,
          cellWidth: '100px',
          props: 'conversionNumber',
        },
        {
          morenName: '备注',
          zidingyiName: '',
          morenState: true,
          zidingyiState: true,
          noModify: false,
          cellWidth: '170px',
          props: 'remark',
        },
        {
          morenName: '单据状态',
          zidingyiName: '',
          morenState: true,
          zidingyiState: true,
          noModify: false,
          cellWidth: '100px',
          props: 'orderStatus_dictText',
        },
        {
          morenName: '制单人',
          zidingyiName: '',
          morenState: true,
          zidingyiState: true,
          noModify: false,
          cellWidth: '100px',
          props: 'createName',
        },
        {
          morenName: '制单日期',
          zidingyiName: '',
          morenState: true,
          sortable: true,
          zidingyiState: true,
          noModify: false,
          cellWidth: '170px',
          props: 'createOrderDate',
        },
        {
          morenName: '单位名称',
          zidingyiName: '',
          morenState: true,
          zidingyiState: true,
          noModify: false,
          cellWidth: '100px',
          props: 'companyName',
        },
        {
          morenName: '经手人',
          zidingyiName: '',
          morenState: true,
          zidingyiState: true,
          noModify: false,
          cellWidth: '100px',
          props: 'sysUserId_dictText',
        },
        {
          morenName: '单价',
          zidingyiName: '',
          morenState: true,
          zidingyiState: true,
          sortable: true,
          noModify: false,
          cellWidth: '100px',
          props: 'price',
        },
        {
          morenName: '税额',
          zidingyiName: '',
          morenState: true,
          zidingyiState: true,
          noModify: false,
          cellWidth: '100px',
          props: 'taxAmount',
        },
      ],
      lookupValue: '', //类别查找值
      // 类别数据
      treeData: [
        {
          label: '所有单据',
          value: '',
          children: [
            {
              label: '销售出库单',
              value: '6'
            },
            {
              label: '销售退货单',
              value: '7'
            },
            {
              label: '销售换货单',
              value: '8'
            },
            {
              label: '采购入库单',
              value: '2'
            },
            {
              label: '采购退货单',
              value: '3'
            },
            {
              label: '采购换货单',
              value: '4'
            },
            {
              label: '盘点单',
              value: '9'
            },
            {
              label: '报损单',
              value: '10'
            },
            {
              label: '报溢单',
              value: '11'
            },
            {
              label: '调拨单',
              value: '12'
            },
            {
              label: '成本调整单',
              value: '13'
            },
            {
              label: '其他入库单',
              value: '25'
            },
            {
              label: '其他出库单',
              value: '26'
            }
          ],
        },
      ],
      batchData: [], // 存储多选的数据
      showLiepeizhi: false, //是否显示列配置
      updateId: '', // 修改列配置时返回的id
      url: {
        exportXlsUrl: '/xghBuyOrder/xghBuyOrder/exportOutInDetail',
      },
      billName: '出入库明细查询',
    }
  },
  mounted() {
    // 初始化列配置数据
    this.defaultColumnData = JSON.parse(JSON.stringify(this.columnData))
    this.selectTitle()
  },
  methods: {
    // 打印
    async handleShortcutKeyPrint() {
      // 查询
      let data = {
        ...this.queryData,
        orderStatus: this.queryData.orderStatus.split(','),
        hideRedRushFlag: this.hideRedRushFlag,// 是否展示红冲单据 1-展示 0-不展示
        pageNo: 1,
        pageSize: 1000000,
      }
      let printExclusive = []
      let url = '/xghBuyOrder/xghBuyOrder/queryOutInDetail'
      let res = await postAction(url, data)
      if (res.code === 200) {
        printExclusive = res.result.records || []
        printExclusive.forEach((item, index) => {
          item.xh = index + 1
        })
        const pricearr = ['taxPrice', 'price']
        const monarr = ['amount', 'taxAmount']
        const numarr = ['number', 'conversionNumber']
        printExclusive = (res.result.records || []).map((item) => {
          // 遍历 item 对象的键
          Object.keys(item).map((key) => {
            if (numarr.includes(key)) {
              item[key] = formatNumber(item[key])
            } else if (monarr.includes(key)) {
              item[key] = formatMoney(item[key])
            } else if (pricearr.includes(key)) {
              item[key] = formatPrice(item[key])
            }
          })
          return item
        })
      }
      this.onQuery()
      // 打印
      if (!this.buttonsPermissions.DaYin) {
        this.$elMessage.warning('未拥有打印权限！')
      } else if (!printExclusive || printExclusive.length <= 0) {
        this.$elMessage.warning('没有要打印的记录！')
      } else {
        let printData = {
          riqi: this.queryData.beginTime.split(' ')[0] + "~" + this.queryData.endTime.split(' ')[0],
          goodsname: this.$refs.goodsname.selected.label,
          cangku: this.$refs.cangku.selected.label,
          printExclusive,
        }
        // 可以多次打印设置
        if (this.printPermissions) {
          this.$refs.print.show(printData, this.columnData, this.billName)
        } else {
          if (this.$lcStorage.get('printLimitValue')) {
            // 获取打印次数
            this.getPrintNum(this.billName, (() => {
              this.$refs.print.show(printData, this.columnData, this.billName)
            }))
          } else {
            this.$refs.print.show(printData, this.columnData, this.billName)
          }
        }
      }
    },
    // 导出
    exportExcel() {
      const fileName = '出入库明细查询'
      let params = {
        ...this.queryData,
        orderStatus: this.queryData.orderStatus.split(','),
        hideRedRushFlag: this.hideRedRushFlag, // 是否展示红冲单据 1-展示 0-不展示
        fileName,
      }
      this.handleExportXlsByStaff(fileName, params)
    },
    // 初始化查询列配置值
    async selectTitle() {
      let obj = await this.$setColumn.selectColumn(this.billName)
      if (obj.code === 200) {
        this.updateId = obj.updateId
        this.columnData = obj.columnData
      } else if (obj.code === 500) {
        let id = await this.$setColumn.addColumn(this.billName, this.$options.data().columnData)
        this.updateId = id
      }
    },
    // 修改列配置后保存修改后的值
    async onSaveColumn(value) {
      this.columnData = value
      let res = await this.$setColumn.editColumn(this.billName, this.columnData, this.updateId)
      if (res.code == 200) {
        this.showTips(res.message, 0)
      } else {
        this.showTips(res.message, 2)
      }
    },
    // 触发树形当前节点
    handleNodeClick(data) {
      this.queryData.pageNo = 1
      this.queryData.orderType = data.value
      this.outOrInStorehouseDetail()
    },
    hideRedRushFlagChange() {
      this.outOrInStorehouseDetail()
    },
    // 商品信息
    getGoodsData() {
      getAction('/xghGoods/xghGoods/getGoodsNameList', {}).then((res) => {
        if (res.code === 200) {
          this.spmcOptions = res.result
          this.totalGoods = res.result
        } else {
          this.showTips(res.message, 2)
        }
      })
    },
    // 仓库信息-下拉框初始化
    getStorehouseOptions() {
      getAction('/xghStorehouse/xghStorehouse/queryListByPole', {}).then((res) => {
        if (res.code === 200) {
          this.ckOptions = res.result
          this.totalStores = res.result
        } else {
          this.showTips(res.message, 2)
        }
      })
    },
    // 出入库明细查询
    outOrInStorehouseDetail() {
      let data = {
        ...this.queryData,
        orderStatus: this.queryData.orderStatus.split(','),
        hideRedRushFlag: this.hideRedRushFlag,// 是否展示红冲单据 1-展示 0-不展示
      }
      this.activeModel = {}
      let url = '/xghBuyOrder/xghBuyOrder/queryOutInDetail'
      postAction(url, data).then((res) => {
        if (res.code === 200) {
          this.total = res.result.total
          let data = res.result.records || []
          this.total = res.result.total
          data.forEach((item, index) => {
            item.xh = index + 1
            item.orderTime = item.orderTime && item.orderTime
            item.conversionNumber = formatNumber(item.conversionNumber)
            item.number = item.number ? formatNumber(item.number) : item.number
            item.taxPrice = item.taxPrice ? formatPrice(item.taxPrice) : item.taxPrice
            item.price = item.price ? formatPrice(item.price) : item.price
            item.amount = item.amount ? formatMoney(item.amount) : item.amount
            item.taxAmount = item.taxAmount ? formatMoney(item.taxAmount) : item.taxAmount
          })
          this.tableData = data
        } else {
          this.showTips(res.message, 2)
        }
      })
    },
    // 查询
    onQuery() {
      this.queryData.pageNo = 1
      this.outOrInStorehouseDetail()
    },
    // 刷新
    onRefresh() {
      Object.assign(this.$data, this.$options.data())
      this.monthValue = '本月'
      this.getTimeRange(this.$setTimeRange(5))
      this.handleNodeClick({})
    },
    // 判断当前选择时间段
    changeDate(val) {
      switch (val) {
        case '全部':
          this.getTimeRange({
            now: '',
            end: ''
          })
          break
        case '今日':
          this.getTimeRange(this.$setTimeRange(1))
          break
        case '昨天':
          this.getTimeRange(this.$setTimeRange(2))
          break
        case '本周':
          this.getTimeRange(this.$setTimeRange(3))
          break
        case '上周':
          this.getTimeRange(this.$setTimeRange(4))
          break
        case '本月':
          this.getTimeRange(this.$setTimeRange(5))
          break
        case '上月':
          this.getTimeRange(this.$setTimeRange(6))
          break
        case '本年':
          this.getTimeRange(this.$setTimeRange(7))
          break
        case '去年':
          this.getTimeRange(this.$setTimeRange(8))
          break
        default:
          break
      }
    },
    // 获取时间范围并设置
    getTimeRange(data) {
      this.nowDate = [data.now, data.end]
      this.queryData.beginTime = data.now + ' 00:00:00'
      this.queryData.endTime = data.end + ' 23:59:59'
    },
    // 获取当前选中时间
    onClickPicker(val) {
      this.queryData.beginTime = val[0] + ' 00:00:00'
      this.queryData.endTime = val[1] + ' 23:59:59'
    },
    // 从后台获取数据,重新排序
    changeSort(val) {
      console.log(val) // column: {…} order: "ascending" prop: "date"
      // 根据当前排序重新获取后台数据,一般后台会需要一个排序的参数
    },
    // 触发表格多选按钮
    handleSelectionChange(val) {
      this.batchData = val
    },
    // 触发列配置弹框
    onShowColumn() {
      this.defaultColumnData = this.$options.data().columnData
      console.log(this.defaultColumnData);
      this.$refs.setColumnRef.dialogVisible = true
    },
    // 合计列计算
    getSummaries(param) {
      const { columns, data } = param
      const sums = []
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = '合计'
        } else if (index === 1) {
          sums[index] = '共' + this.total + '条明细'
        } else if (column.property === 'number'
          || column.property === 'amount' || column.property === 'conversionNumber'
          || column.property === 'taxAmount') {
          const values = data.map((item) => delcommafy(item[column.property]))
          if (!values.every((value) => isNaN(value))) {
            sums[index] = values.reduce((prev, curr) => {
              const value = delcommafy(curr)
              if (!isNaN(value)) {
                return prev + curr
              } else {
                return prev
              }
            }, 0)
            if (['number', 'conversionNumber'].includes(column.property)) {
              sums[index] = formatNumber(sums[index]) // 保留2位小数，解决小数列合计精度缺失的问题
            } else if (['taxPrice', 'price'].includes(column.property)) {
              sums[index] = this.$formatPrice(sums[index])
            } else {
              sums[index] = formatMoney(sums[index]) // 保留2位小数，解决小数列合计精度缺失的问题
            }
          }
        } else {
          sums[index] = ''
        }
      })
      return sums
    },
    // 获取每页几条数据
    handleSizeChange(val) {
      this.queryData.pageSize = val
      this.outOrInStorehouseDetail()
    },
    // 获取当前第几页
    handleCurrentChange(val) {
      this.queryData.pageNo = val
      this.outOrInStorehouseDetail()
    },
    // 显示商品弹窗
    onShowCommodity() {
      this.$refs.commodityRef.dialogVisible = true
    },
    // 选择商品
    onSelectCommodity(val) {
      // 获取到选择的商品
      // val.id
      this.queryData.goodsId = val.id
      this.queryData.goodsName = val.goodsName
    },
    // 下拉选择商品
    onChangeGoods(val) {
      this.queryData.goodsName = this.spmcOptions.find(item => item.id === val).goodsName
    },
    onLookBill() {
      if (JSON.stringify(this.activeModel) == "{}") {
        this.activeModel = this.tableData[0]
      }
      // 跳转对应单据页面
      toBillDetail(this, this.activeModel.orderType, this.activeModel.orderId)
    },
    /**
     * 处理表格每一个行
     */
    handleRowDbclick(row) {
      toBillDetail(this, row.orderType, row.orderId)
    },
    rowClick(row, column, event) {
      this.activeModel = row
    },
    // 搜索
    handleFilterMethod(value, label) {
      if (label == 'storehouseName') {
        this.ckOptions = this.filterMethod(this.ckOptions, value, label)
      } else if (label == 'goodsName') {
        this.spmcOptions = this.filterMethod(this.spmcOptions, value, label)
      }
    },
    showTips(msg, type = 1) {
      switch (type) {
        case 0:
          this.$elMessage.success(msg)
          break;
        case 1:
          this.$elMessage.warning(msg)
          break;
        case 2:
          this.$elMessage.error(msg)
          break;
      }
    },
  },
}
</script>

<style lang="scss" scoped>
$font-size: 12px;
$height-input: 30px; //0.55rem的高度
$height: 50px; //1rem的高度

.basic_info {
  width: 100%;
  height: 100%;
  background: #f0f2f5;
  box-sizing: border-box;
  padding: 0 10px;
  display: flex;
  flex-direction: column;
}

.info_operation_btn {
  width: 100%;
  height: $height;
  display: flex;
  align-items: center;

  ::v-deep .el-button {
    width: 80px;
    height: $height-input;
    text-align: center;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: $font-size;
    border-radius: 0.1rem;
    border: none;
    margin-right: 6px;
    margin-left: 0;
  }

  .el-button--default {
    color: #666;
  }

  ::v-deep .el-select {
    width: 1rem;
    height: $height-input;
    box-sizing: border-box;
    margin-right: 0.112507rem;

    .el-input {
      .el-input__inner {
        height: $height-input;
        border: none;
        font-size: $font-size;
      }

      .el-input__suffix {
        height: $height-input;
        display: flex;
        align-items: center;
      }
    }
  }

  .btn_left {
    width: 60%;
    display: flex;
    justify-content: flex-start;
    align-items: center;

    ::v-deep .el-checkbox {
      display: flex;
      align-items: center;
      margin-left: 8px;
      margin-right: 8px;

      .el-checkbox__input {
        height: 15px;
      }

      .el-checkbox__label {
        font-size: $font-size;
        padding-left: 5px;
        color: #666;
      }

      .is-checked {
        .el-checkbox__inner {
          background: #1a93fa;
          border-color: #1a93fa;
        }
      }
    }
  }

  .btn_right {
    width: 40%;
    display: flex;
    justify-content: flex-end;
    align-items: center;

    .el-input {
      width: 4.725295rem;
      height: $height-input;
      margin-right: 0.112507rem;

      ::v-deep .el-input__inner {
        height: $height-input;
        border: none;
        box-sizing: border-box;
        padding: 0 0.15rem;
        background: #fff;
        font-size: $font-size;
        color: #666;

        &::placeholder {
          font-size: $font-size;
          color: #c1c1c1;
        }
      }
    }

    .el-button {
      width: 1rem;
    }

    .set_up {
      font-size: 20px;
      color: rgb(153, 153, 153);
    }
  }
}

.info_content_div {
  width: 100%;
  height: calc(100% - 60px);
  background: #fff;
  box-sizing: border-box;
  padding: 0 10px;
  display: flex;
  flex-direction: column;
  font-size: 12px;
  .div_screen {
    width: 100%;
    display: flex;
    justify-content: space-between;
    box-sizing: border-box;

    ::v-deep .el-select {
      height: $height-input;
      box-sizing: border-box;
      border-radius: 4px;

      .el-input {
        .el-input__inner {
          height: $height-input;
          border-color: #e3e3e3;
          font-size: $font-size;
          padding-left: 0.15rem;
        }

        .el-input__suffix {
          height: $height-input;
          display: flex;
          align-items: center;
        }
      }
    }

    input {
      height: $height-input;
      background: #ffffff;
      border: 1px solid #e3e3e3;
      opacity: 1;
      border-radius: 4px;
      font-size: $font-size;
      color: #666;
      box-sizing: border-box;
      padding: 0 0.15rem;

      &:focus {
        outline: none;
        border-color: #1890ff;
      }

      &::placeholder {
        font-size: $font-size;
        color: #c1c1c1;
      }
    }

    .screen_left {
      height: 100%;
      box-sizing: border-box;
      display: flex;
      justify-content: flex-start;
      align-items: center;
      flex-wrap: wrap;

      >div {
        width: 176px;
        height: $height-input;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        margin-right: 14px;
        margin-top: 15px;

        >p {
          margin: 0;
          width: auto;
          min-width: 50px;
          margin-right: 6px;
          font-size: $font-size;
          font-family: PingFang SC;
          font-weight: 400;
          color: #666666;
          text-align: justify;
          text-justify: distribute-all-lines;
          /*ie6-8*/
          text-align-last: justify;
          /* ie9*/
          -moz-text-align-last: justify;
          /*ff*/
          -webkit-text-align-last: justify;
          /*chrome 20+*/
        }

        .screen_select {
          flex: 1;
          display: flex;
          height: 30px;
          align-items: center;
          margin-right: 0;
          text-align: left;
          text-align-last: left;
        }
      }
    }

    .screen_right {
      display: flex;
      margin-top: 15px;

      ::v-deep .el-button {
        height: $height-input;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: $font-size;
        border-radius: 5px;
        border: none;
      }

      ::v-deep .el-select {
        width: 80px;
        margin-right: 6px;
      }

      ::v-deep .el-date-editor {
        width: 220px;
        height: $height-input;
        background: #ffffff;
        border: 1px solid #d9d9d9;
        margin-right: 0.112507rem;
        padding: 3px 6px;

        .el-range__icon {
          position: absolute;
          right: 0;
          line-height: 30px;
        }

        .el-range-separator {
          line-height: 24px;
        }

        .el-range-input {
          font-size: $font-size;
        }

        .el-range__close-icon {
          display: none;
        }
      }

      >div:nth-child(2) {
        justify-content: flex-start;
      }
    }
  }

  .div_table {
    width: 100%;
    height: calc(100% - 120px);
    margin-top: 12px;
    display: flex;
    box-sizing: border-box;

    .div_tree {
      width: 2.8rem;
      height: 100%;
      box-sizing: border-box;
      padding: 0.131258rem 0;
      border: 0.018751rem solid #e3e3e3;
      transition: all 0.3s;

      .tree_div1 {
        width: 100%;
        height: 0.337521rem;
        box-sizing: border-box;
        padding: 0 0.168761rem;
        display: flex;
        align-items: center;
        justify-content: space-between;

        p {
          color: #666666;
          font-size: $font-size;
        }
      }

      .tree_input {
        width: 100%;
        height: $height-input;
        margin-top: 0.131258rem;
        box-sizing: border-box;
        padding: 0 0.168761rem;

        p {
          width: 100%;
          height: $height-input;
          margin: 0;
          box-sizing: border-box;
          border: 1px solid #dddddd;
          display: flex;
          align-items: center;
          position: relative;

          input {
            width: 100%;
            box-sizing: border-box;
            padding: 0 0.6rem 0 0.1rem;
            height: 0.525033rem;
            border: none;
            font-size: $font-size;

            &:focus {
              outline: none;
            }
          }

          span {
            position: absolute;
            right: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 0.55rem;
            height: 0.525033rem;
            background: #fff;

            .el-icon-search {
              font-size: $font-size;
              color: rgb(211, 211, 211);
            }
          }
        }
      }

      .tree_structure {
        width: 100%;
        height: calc(100% - 0.337521rem - 0.131258rem - 0.131258rem - 0.55rem);
        box-sizing: border-box;
        padding: 0 0.168761rem;
        margin-top: 0.131258rem;
        overflow: auto;

        ::v-deep .el-tree {
          width: 100%;

          .el-tree-node__children {
            .el-tree-node__label {
              color: #666;
              font-weight: normal;
            }
          }

          .el-tree-node__label {
            font-size: $font-size;
            font-weight: 600;
          }

          .el-tree-node__content>.el-tree-node__expand-icon {
            padding-left: 0;
          }
        }
      }
    }

    .table_content {
      width: calc(100% - 3rem);
      margin-left: 0.187512rem;
      height: 100%;

      ::v-deep .el-table {
        border: 1px solid #e3e3e3;
        border-bottom: none;
        box-sizing: border-box;

        th,
        td {
          padding: 0;
          color: #666;
          box-sizing: border-box;
          border-right: 1px solid #e3e3e3;

          .cell {
            height:50px;
            display: flex;
            align-items: center;
            font-size: $font-size;
          }

          &:first-child {
            .cell {
              justify-content: center;
              padding: 0;
            }
          }
        }

        th {
          .cell {
            background: #ededed;
            justify-content: center;
          }
        }

        .el-table__body tr:hover>td {
          background: #e3f6ff;
        }

        .el-table__footer-wrapper {
          td {
            background: #f4f4f4;
            border: none;
          }
        }

        //滚动条的宽度
        ::-webkit-scrollbar {
          width: 8px;
          height: 10px;
          background-color: #e5e5e5;
        }

        //滚动条的滑块
        ::-webkit-scrollbar-thumb {
          background-color: #c9c9c9;
        }
      }
    }
  }

  .table_pagination {
    width: 100%;
    height: 30px;
    margin-top: 18px;
    box-sizing: border-box;
    padding: 0;
    display: flex;

    .pagination_div {
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: flex-end;

      ::v-deep .el-pagination {
        padding: 0;
        height: 30px;

        .el-pagination__sizes {
          margin: 0;

          .el-input {
            margin-right: 0;
          }
        }
      }
    }
  }
}

.screen_select_more_top {
  display: flex;
  align-items: center;

  .screen_select_more_title {
    width: 50px;
    margin-right: 6px;
    line-height: $height-input;
    color: #666666;
    text-justify: distribute-all-lines;
    /*ie6-8*/
    text-align-last: justify;
    /* ie9*/
    -moz-text-align-last: justify;
    /*ff*/
    -webkit-text-align-last: justify;
    /*chrome 20+*/
  }

  .screen_select_more_input {
    flex: 1;
    height: $height-input;
    position: relative;

    ::v-deep .el-select {
      .el-input {
        .el-input__inner {
          height: $height-input;
          border-color: #e3e3e3;
          font-size: $font-size;
          padding-left: 5px;
        }

        .el-input__suffix {
          height: $height-input;
          display: flex;
          align-items: center;
        }
      }
    }

    ::v-deep .el-input {
      width: 100%;

      .el-input__inner {
        height: $height-input;
        border-color: #e3e3e3;
        font-size: 12px;
        padding-left: 5px;
      }

      .el-input__suffix {
        height: $height-input;
        display: flex;
        align-items: center;
      }
    }

    .screen_select_custom_more {
      position: absolute;
      right: 10px;
      z-index: 10;
      top: 1px;
      background: #fff;
      height: 28px;
      display: flex;
      align-items: center;
      color: #bfbfbf;
    }
  }
}
</style>